package com.ray.file.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * minio配置类
 *
 * @author LiuBi
 * @version 1.0
 * @createDate 2024/5/27 15:35
 **/
@Configuration
public class MinioConfig {
    /**
     * minio地址 2024/5/27 15:51
     */
    @Value("${minio.endpoint}")
    private String endpoint;
    /**
     * minio账户 2024/5/27 15:51
     */
    @Value("${minio.accessKey}")
    private String accessKey;
    /**
     * minio密码2024/5/27 15:51
     */
    @Value("${minio.secretKey}")
    private String secretKey;

    /**
     * 生成 minioClient Bean
     *
     * @return minioClient
     * @author liubi 2024/5/27 15:48
     **/
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder().endpoint(endpoint)
                .credentials(accessKey, secretKey)
                .build();
    }
}
